package cn.zn.modules.controller;

import cn.zn.modules.kettle.dto.ExecJobDTO;
import cn.zn.modules.kettle.service.KettleJobService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * <pre>
 * @projectName: finance-all
 * @packageName: cn.zn.modules.kettle.controller
 * @className: KettleJobController
 * @description: 说明类用途
 * @author: zn
 * @date: 2022/2/8 9:56
 * </pre>
 */
@RestController
@RequestMapping("kettlejob")
@Slf4j
@Api(tags = "历史数据")
public class KettleJobController {
    @Autowired
    private KettleJobService kettleJobService;

    @PostMapping("execJobTurn")
    @ApiOperation("数据转Mongo")
    public void execJobTurn(@Validated @RequestBody ExecJobDTO dto) {
        kettleJobService.execJobTurn(dto.getAp(), dto.getMysqlDbName());
    }

    @DeleteMapping("cleanByAp")
    @ApiOperation("数据清理Mongo")
    public void cleanByAp(@RequestBody Integer ap) {
        kettleJobService.cleanByAp(ap);
    }
}
